#!/usr/bin/python
#coding:utf8
'''
Template Method
'''
# 构建冲泡饮料的模板方法
class Beverage:
    def brew(self):
        pass
    def addCondiments(self):
        pass
    def pourInCup(self):
        print("Pouring in cup")
    def boilWater(self):
        print("Boiling water")
    def prepareRecipe(self):
        self.boilWater()
        self.brew()
        self.pourInCup()
        self.addCondiments()

# 实现冲泡咖啡
class Coffee(Beverage):
    def brew(self):
        print("Brewing coffee")
    def addCondiments(self):
        print("Adding sugar and milk")
# 实现泡茶
class Tea(Beverage):
    def brew(self):
        print("Brewing tea")
    def addCondiments(self):
        print("Adding lemon")

if __name__ == '__main__':
    coffee = Coffee()
    coffee.prepareRecipe()
    print("-----")
    tea = Tea()
    tea.prepareRecipe()